package com.chuang.bootplus.controller.user;


import com.chuang.bootplus.base.utils.ApiResponse;
import com.chuang.bootplus.entity.Uuser;
import com.chuang.bootplus.po.LoginPO;
import com.chuang.bootplus.po.UUserPO;
import com.chuang.bootplus.service.UuserService;
import com.chuang.bootplus.vo.UserInfoVO;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2021-11-11
 */
@RestController
@RequestMapping("/uuser")
@Api(tags = {"Uuser信息"})
@CrossOrigin(origins = "*")
public class UuserController {

    @Autowired
    UuserService uuserService;

    @PostMapping("login")
    @ApiOperation(httpMethod = "POST", value = "Uuser登陆")
    @ApiOperationSupport(includeParameters = {"UUserPO.username", "UUserPO.password"})
    public ApiResponse<UserInfoVO> userLogin(@RequestBody UUserPO po) {
        return uuserService.login(po);
    }
    @PostMapping("register")
    @ApiOperation(httpMethod = "POST", value = "Uuser注册")
    @ApiOperationSupport(includeParameters = {"UUserPO.username", "UUserPO.password"})
    public ApiResponse<UserInfoVO> register(@RequestBody UUserPO po) {
        return uuserService.register(po);
    }


}

